//package com.aqa.concurrent;
//
//import sun.misc.Unsafe;
//
//import java.lang.reflect.Field;
//import java.util.concurrent.ThreadLocalRandom;
//
//public class ThreadProbeTest {
//
//    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException, InterruptedException {
//
//        ThreadLocalRandom current = ThreadLocalRandom.current();
//
//        Field f = Unsafe.class.getDeclaredField("theUnsafe");
//        f.setAccessible(true);
//        Unsafe unsafe = (Unsafe) f.get(null);
//
//        Class<?> tk = Thread.class;
//        long PROBE = unsafe.objectFieldOffset
//                (tk.getDeclaredField("threadLocalRandomProbe"));
//        System.out.println("unsafe.getInt(Thread.currentThread(), PROBE) = " + unsafe.getInt(Thread.currentThread(), PROBE));
//
//        new Thread(() -> {
//            try {
//                Unsafe unsafe2 = (Unsafe) f.get(null);
//
//                Class<?> tk2 = Thread.class;
//                long PROBE2 = unsafe2.objectFieldOffset
//                        (tk2.getDeclaredField("threadLocalRandomProbe"));
//                System.out.println("unsafe2.getInt(Thread.currentThread(), PROBE) = " + unsafe2.getInt(Thread.currentThread(), PROBE2));
//
//            }catch (Exception e){
//                e.printStackTrace();
//            }
//        }).start();
//
//        System.out.println("(0 & 2) = " + (0 & 2));
//
//        Thread.currentThread().join();
//    }
//
//
//}
